package com.bocaizp.operation.controller.user;

import com.bocaizp.common.result.PageResult;
import com.bocaizp.common.result.Result;
import com.bocaizp.operation.service.QueryJobService;
import com.bocaizp.pojo.DTO.JobDataDTO;
import com.bocaizp.pojo.VO.HotJobVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Author : huang jie
 * Date : 2024/5/3 23:09
 **/
@RestController
@RequestMapping("/user")
@Slf4j
@CrossOrigin
public class QueryJobController {

	@Autowired
	private QueryJobService queryJobService;

	/**
	 * 推荐职位展示
	 * @param jobDataDTO
	 * @return
	 */
	@PostMapping("/queryjob/getjob")
	public Result<PageResult> jobRecommend(@RequestBody JobDataDTO jobDataDTO){
		log.info("推荐职位请求...");
		PageResult pageResult = queryJobService.jobRecommend(jobDataDTO);
		return Result.success(pageResult);
	}

	/**
	 * 热招职位
	 * @param job
	 * @return
	 */
	@GetMapping("/hotjob")
	public Result<List<HotJobVO>> hotJobResult(String job){
		log.info("热招职位请求...{}",job);
		List<HotJobVO> hotJobVOS = queryJobService.gethotJob(job);
		return Result.success(hotJobVOS);
	}

	/**
	 * 增加热度
	 * @param id
	 * @return
	 */
	@GetMapping("/addhot")
	public Result addHot(Long id){
		log.info("增加热度...");
		queryJobService.addHot(id);
		return Result.success();
	}
}
